package com.saianfu.flowable.demo.common

import org.flowable.engine.runtime.ProcessInstance
import org.flowable.engine.runtime.ProcessInstanceQuery

/**
 * 流程实例查询相关封装
 */
interface ActInstanceQuery {
    /**
     * 流程实例查询对象
     *
     * @return
     */
    fun createProcessInstanceQuery(): ProcessInstanceQuery?

    /**
     * 查询流程实例
     *
     * @param processInstanceId 流程实例标识
     * @return
     */
    fun processInstanceId(processInstanceId: String): ProcessInstance?

    /**
     * 查询流程实例
     *
     * @param processInstanceBusinessKey 流程实例业务键名
     * @return
     */
    fun processInstanceBusinessKey(processInstanceBusinessKey: String): ProcessInstance?

    /**
     * 查询流程实例
     *
     * @param taskId 流程任务标识
     * @return
     */
    fun taskId(taskId: String): ProcessInstance?

    /**
     * 判断流程实例是否已结束
     *
     * @param processInstanceId 流程实例标识
     * @return
     */
    fun hasProcessInstanceFinished(processInstanceId: String): Boolean
}